package com.by.facade.enums.wxCp;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Tian Wei
 * @version 1.0
 * @date 2024/5/17 5:35 PM
 */
@Getter
@AllArgsConstructor
public enum WxCpChatTypeEnum {

    chatPrivate(1, "私聊"),
    chatGroup(2, "群聊"),

    ;

    private final Integer type;

    private final String desc;

    private static final Map<Integer, WxCpChatTypeEnum> MAP;

    static {
        MAP = Stream.of(WxCpChatTypeEnum.values())
                .collect(Collectors.toMap(WxCpChatTypeEnum::getType, Function.identity()));
    }

    public static WxCpChatTypeEnum resolveByType(Integer type){
        return MAP.get(type);
    }
}
